var mysql = require('mysql');
var lib = require('../../lib/index.js');

var connection = lib.connection();

// var sql = 'SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = "test"';
var sql = 'SELECT table_name,table_rows FROM information_schema.tables WHERE TABLE_SCHEMA = "test" ORDER BY table_rows DESC;'
connection.query(sql, function(err, result) {
    // console.log(result);
    var count = 0;
    var index=0;
    for(var i=0;i<result.length;i++){
        if(result[i].table_name.indexOf('products')>-1){
            count += result[i].table_rows;

            index++;
        }
    }
    console.log(lib.getTime());
    console.log('count:'+count);
    console.log('index:'+index);
    if (err) {
        console.log(err);
        return;
    }
});

connection.end();
